package com.itqf.controller;

import org.apache.shiro.authz.UnauthenticatedException;
import org.apache.shiro.authz.UnauthorizedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * projectName: rbac2103
 *
 * @author: 赵伟风
 * time: 2021/7/10 16:01
 * description:
 */
@ControllerAdvice
public class ExceptionController {


    @ExceptionHandler(UnauthenticatedException.class)
    public String handler(UnauthenticatedException e){

        System.out.println("认证失败!");

        return "noauthentication";
    }


    @ExceptionHandler(UnauthorizedException.class)
    public String handler(UnauthorizedException e){

        System.out.println("授权失败!");

        return "noauthorization";
    }

}
